/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 头部样式 */
.app-header {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.app-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.app-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 300;
}

/* 主内容区域 */
.app-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

/* 错误显示 */
.error-display {
  margin-bottom: 1rem;
}

.error-content {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #c33;
}

.error-icon {
  flex-shrink: 0;
}

.error-message {
  flex: 1;
}

.error-dismiss {
  background: none;
  border: none;
  color: #c33;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.error-dismiss:hover {
  background: rgba(204, 51, 51, 0.1);
}

/* 输入区域 */
.input-section {
  margin-bottom: 2rem;
}

.text-input-container {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.input-wrapper {
  position: relative;
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.text-input {
  flex: 1;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  padding: 1rem;
  font-size: 1rem;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: #667eea;
}

.text-input:disabled {
  background: #f8f9fa;
  color: #6c757d;
}

.submit-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 60px;
}

.submit-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 结果容器 */
.results-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .results-container {
    grid-template-columns: 1fr;
  }
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 情绪显示 */
.mood-display {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-height: 300px;
}

.mood-display.loading,
.mood-display.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6c757d;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.mood-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mood-icon {
  flex-shrink: 0;
}

.mood-info h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.mood-description {
  color: #6c757d;
  font-size: 0.95rem;
}

.mood-details {
  margin-bottom: 1.5rem;
}

.mood-metric {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.metric-label {
  min-width: 60px;
  font-weight: 500;
  font-size: 0.9rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.metric-value {
  min-width: 40px;
  text-align: right;
  font-weight: 500;
  font-size: 0.9rem;
}

.mood-keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.keywords-label {
  font-weight: 500;
  color: #495057;
}

.keyword-tag {
  background: #e9ecef;
  color: #495057;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* 图片显示 */
.image-display {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-height: 300px;
}

.image-display.loading,
.image-display.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6c757d;
}

.empty-icon {
  opacity: 0.5;
  margin-bottom: 1rem;
}

.image-container {
  position: relative;
  margin-bottom: 1rem;
}

.generated-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.image-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
  color: #6c757d;
}

.image-error.hidden {
  display: none;
}

.image-info {
  margin-bottom: 1rem;
}

.image-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.meta-label {
  font-weight: 500;
  color: #495057;
}

.meta-value {
  color: #6c757d;
}

.image-actions {
  margin-bottom: 1rem;
}

.download-button {
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.download-button:hover {
  background: #218838;
}

.image-prompt {
  border-top: 1px solid #e9ecef;
  padding-top: 1rem;
}

.image-prompt summary {
  cursor: pointer;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
}

.prompt-text {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.5;
}

/* 历史记录 */
.history-section {
  margin-top: 3rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.history-item {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.history-item:hover {
  transform: translateY(-2px);
}

.history-image {
  height: 150px;
  overflow: hidden;
}

.history-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-info {
  padding: 1rem;
}

.history-text {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.history-emotion {
  font-size: 0.8rem;
  color: #6c757d;
  font-style: italic;
}

/* 底部 */
.app-footer {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

/* 动画 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.icon-spin {
  animation: spin 1s linear infinite;
}

.icon-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

.hint {
  font-style: italic;
  color: #6c757d;
}

.hidden {
  display: none;
}